WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
wolf::ProcessorBase Class Referenceabstract

Base class of processors: they process the captures of a sensor and the keyframes created by other processors, creating features, factors, landmarks and voting for keyframes. More...

#include <core/processor/processor_base.h>

Inheritance diagram for wolf::ProcessorBase:
[legend]

Public Member Functions

void startCaptureProfiling ()
 Starts the profiling of a capture processing. More...
 
void stopCaptureProfiling ()
 Stops the profiling of a capture processing. More...
 
void startKFProfiling ()
 Starts the profiling of a keyframe processing. More...
 
void stopKFProfiling ()
 Stops the profiling of a keyframe processing. More...
 
virtual void printProfiling (std::ostream &stream=std::cout) const
 Prints the profiling of the capture and keyframe processing. More...
 
 ProcessorBase (const std::string &_type, const TypeComposite &_state_types, const YAML::Node &_params)
 Constructor. More...
 
 ~ProcessorBase () override
 
virtual void configure (SensorBasePtr _sensor)=0
 Configures the processor once linked to its sensor. More...
 
virtual void remove ()
 Removes the processor from its sensor (and from the motion providers of the problem) More...
 
bool hasChildren () const override
 Returns whether the node has children in the Wolf tree. More...
 
const TypeComposite & getStateTypes () const
 Returns the state types of the frames created or used by this processor. More...
 
StateKeys getStateKeys () const
 Returns the state keys of the frames created or used by this processor. More...
 
unsigned int id () const
 Returns the processor id. More...
 
void keyFrameCallback (FrameBasePtr _keyframe)
 Notifies a new keyframe (created by another processor) More...
 
void captureCallback (CaptureBasePtr _capture)
 Notifies a new capture. More...
 
SensorBaseConstPtr getSensor () const
 Returns the sensor the processor belongs to. More...
 
SensorBasePtr getSensor ()
 Returns the sensor the processor belongs to. More...
 
YAML::Node getParams () const
 Returns a copy of the YAML parameters. More...
 
bool isMotionProvider () const
 Returns whether the processor is a MotionProvider. More...
 
bool applyLossFunction () const
 Returns whether the factors created by the processor apply a loss function. More...
 
bool isVotingActive () const
 Returns whether the processor can vote for keyframes. More...
 
double getTimeTolerance () const
 Returns the time tolerance to associate time stamps. More...
 
void setApplyLossFunction (bool _apply_loss_function)
 Sets whether the factors created by the processor apply a loss function. More...
 
void setVotingActive (bool _voting_active)
 Sets whether the processor can vote for keyframes. More...
 
void setTimeTolerance (double _time_tolerance)
 Sets the time tolerance to associate time stamps. More...
 
void setDebugVerboseLevel (const std::string &_debug_verbose_level)
 Sets the debug verbosity level: "none", "derived", "base" or "all". More...
 
std::string getDebugVerboseLevel () const
 Returns the debug verbosity level. More...
 
bool checkTimeTolerance (const TimeStamp &_ts1, const TimeStamp &_ts2) const
 Returns whether two time stamps are within the time tolerance. More...
 
bool checkTimeTolerance (const CaptureBasePtr _cap, const TimeStamp &_ts) const
 Returns whether the capture and a time stamp are within the time tolerance. More...
 
bool checkTimeTolerance (const FrameBasePtr _frm, const TimeStamp &_ts) const
 Returns whether the frame and a time stamp are within the time tolerance. More...
 
bool checkTimeTolerance (const FrameBasePtr _frm, const CaptureBasePtr _cap) const
 Returns whether the frame and the capture are within the time tolerance. More...
 
virtual void link (SensorBasePtr) final
 Links the processor to a sensor. More...
 
virtual void printHeader (int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream, std::string _tabs="") const
 Prints the information of this node (not of its children) More...
 
void print (int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream=std::cout, std::string _tabs="") const
 Prints this node and, depending on the depth, its children. More...
 
virtual CheckLog localCheck (bool _verbose, std::ostream &_stream, std::string _tabs="") const
 Checks the consistency of this node (not of its children) More...
 
bool check (CheckLog &_log, bool _verbose, std::ostream &_stream, std::string _tabs="") const
 Checks the consistency of this node and its children, composing the log. More...
 
- Public Member Functions inherited from wolf::NodeBase
 NodeBase (const std::string &_category, const std::string &_type="Undefined", const std::string &_name="")
 Constructor. More...
 
virtual ~NodeBase ()=default
 Destructor. More...
 
unsigned int nodeId () const
 Returns the node id, unique over the whole Wolf tree. More...
 
std::string getCategory () const
 Returns the category of the node. More...
 
std::string getType () const
 Returns the type (subcategory) of the node. More...
 
std::string getName () const
 Returns the name of the node. More...
 
bool isRemoving () const
 Returns whether the node is being removed. More...
 
virtual bool hasChildren () const =0
 Returns whether the node has children in the Wolf tree. More...
 
void setType (const std::string &_type)
 Sets the type (subcategory) of the node. More...
 
void setName (const std::string &_name)
 Sets the name of the node. More...
 
ProblemConstPtr getProblem () const
 Returns the problem the node belongs to. More...
 
ProblemPtr getProblem ()
 Returns the problem the node belongs to. More...
 

Protected Member Functions

virtual void processCapture (CaptureBasePtr)=0
 Processes an incoming capture. More...
 
virtual void processKeyFrame (FrameBasePtr _keyframe_ptr)=0
 Processes an incoming keyframe. More...
 
virtual bool triggerInCapture (CaptureBasePtr) const =0
 Returns whether processCapture() should be called after the provided capture arrived. More...
 
virtual bool triggerInKeyFrame (FrameBasePtr) const =0
 Returns whether processKeyFrame() should be called after the provided keyframe arrived. More...
 
virtual bool storeKeyFrame (FrameBasePtr)=0
 Returns whether the provided keyframe should be stored in buffer_frame_. More...
 
virtual bool storeCapture (CaptureBasePtr)=0
 Returns whether the provided capture should be stored in buffer_capture_. More...
 
virtual bool voteForKeyFrame () const =0
 Votes for keyframe generation. More...
 
virtual bool permittedKeyFrame () const final
 Returns whether this processor can create a keyframe: voting is active and the problem permits it. More...
 
void setProblem (ProblemPtr) override
 Sets the problem, adding the state types to it and, if it is a state provider, the processor as motion provider. More...
 
void addTypes (const TypeComposite &)
 Adds the provided state types to the processor and to the problem (if set). Throws if a key already has a different type. More...
 
virtual void setProblem (ProblemPtr _prob_ptr)
 Sets the problem the node belongs to. More...
 

Protected Attributes

unsigned int processor_id_
 Processor id, unique among processors. More...
 
YAML::Node params_
 YAML parameters. More...
 
BufferFrame buffer_frame_
 Buffer of the received keyframes to be processed. More...
 
BufferCapture buffer_capture_
 Buffer of the received captures to be processed. More...
 
std::string debug_verbose_level_
 Debug verbosity level: "none", "derived", "base" or "all". More...
 
- Protected Attributes inherited from wolf::NodeBase
ProblemWPtr problem_ptr_
 Problem the node belongs to. More...
 
unsigned int node_id_
 Node id. It is unique over the whole Wolf Tree. More...
 
std::string node_category_
 Text label identifying the category of node ("SENSOR", "FEATURE", etc) More...
 
std::string node_type_
 Type or subcategory of node (derived class name: "SensorOdom2d", etc) More...
 
std::string node_name_
 
bool is_removing_
 A flag for safely removing nodes from the Wolf tree. See remove(). More...
 

Detailed Description

Base class of processors: they process the captures of a sensor and the keyframes created by other processors, creating features, factors, landmarks and voting for keyframes.

Constructor & Destructor Documentation

◆ ProcessorBase()

wolf::ProcessorBase::ProcessorBase ( const std::string &  _type,
const TypeComposite &  _state_types,
const YAML::Node &  _params 
)

Constructor.

Parameters
_typeTO BE HARDCODED IN THE DERIVED CLASS CONSTRUCTOR: type name
_state_typesTO BE HARDCODED IN THE DERIVED CLASS CONSTRUCTOR: The composite of state types of the frames created or used by this processor
_paramsparams yaml node

◆ ~ProcessorBase()

wolf::ProcessorBase::~ProcessorBase ( )
override

Member Function Documentation

◆ addTypes()

void wolf::ProcessorBase::addTypes ( const TypeComposite &  _state_types)
protected

Adds the provided state types to the processor and to the problem (if set). Throws if a key already has a different type.

◆ applyLossFunction()

bool wolf::ProcessorBase::applyLossFunction ( ) const
inline

Returns whether the factors created by the processor apply a loss function.

◆ captureCallback()

void wolf::ProcessorBase::captureCallback ( CaptureBasePtr  _capture)

Notifies a new capture.

It applies the first frame options of the problem (if not applied yet), stores the capture in buffer_capture_ if storeCapture(), and processes it with processCapture() if triggerInCapture().

◆ check()

bool wolf::ProcessorBase::check ( CheckLog &  _log,
bool  _verbose,
std::ostream &  _stream,
std::string  _tabs = "" 
) const

Checks the consistency of this node and its children, composing the log.

◆ checkTimeTolerance() [1/4]

bool wolf::ProcessorBase::checkTimeTolerance ( const CaptureBasePtr  _cap,
const TimeStamp &  _ts 
) const

Returns whether the capture and a time stamp are within the time tolerance.

◆ checkTimeTolerance() [2/4]

bool wolf::ProcessorBase::checkTimeTolerance ( const FrameBasePtr  _frm,
const CaptureBasePtr  _cap 
) const

Returns whether the frame and the capture are within the time tolerance.

◆ checkTimeTolerance() [3/4]

bool wolf::ProcessorBase::checkTimeTolerance ( const FrameBasePtr  _frm,
const TimeStamp &  _ts 
) const

Returns whether the frame and a time stamp are within the time tolerance.

◆ checkTimeTolerance() [4/4]

bool wolf::ProcessorBase::checkTimeTolerance ( const TimeStamp &  _ts1,
const TimeStamp &  _ts2 
) const

Returns whether two time stamps are within the time tolerance.

◆ configure()

virtual void wolf::ProcessorBase::configure ( SensorBasePtr  _sensor)
pure virtual

◆ getDebugVerboseLevel()

std::string wolf::ProcessorBase::getDebugVerboseLevel ( ) const
inline

Returns the debug verbosity level.

◆ getParams()

YAML::Node wolf::ProcessorBase::getParams ( ) const
inline

Returns a copy of the YAML parameters.

◆ getSensor() [1/2]

SensorBasePtr wolf::ProcessorBase::getSensor ( )
inline

Returns the sensor the processor belongs to.

◆ getSensor() [2/2]

SensorBaseConstPtr wolf::ProcessorBase::getSensor ( ) const
inline

Returns the sensor the processor belongs to.

◆ getStateKeys()

StateKeys wolf::ProcessorBase::getStateKeys ( ) const
inline

Returns the state keys of the frames created or used by this processor.

◆ getStateTypes()

const TypeComposite & wolf::ProcessorBase::getStateTypes ( ) const
inline

Returns the state types of the frames created or used by this processor.

◆ getTimeTolerance()

double wolf::ProcessorBase::getTimeTolerance ( ) const
inline

Returns the time tolerance to associate time stamps.

Recommended value: half of the sensor period (or smaller). Larger values are allowed (the closest element is always chosen), but time stamps up to the tolerance apart are considered the same instant, which introduces errors.

◆ hasChildren()

bool wolf::ProcessorBase::hasChildren ( ) const
inlineoverridevirtual

Returns whether the node has children in the Wolf tree.

Implements wolf::NodeBase.

◆ id()

unsigned int wolf::ProcessorBase::id ( ) const
inline

Returns the processor id.

◆ isMotionProvider()

bool wolf::ProcessorBase::isMotionProvider ( ) const
inline

Returns whether the processor is a MotionProvider.

◆ isVotingActive()

bool wolf::ProcessorBase::isVotingActive ( ) const
inline

Returns whether the processor can vote for keyframes.

◆ keyFrameCallback()

void wolf::ProcessorBase::keyFrameCallback ( FrameBasePtr  _keyframe)

Notifies a new keyframe (created by another processor)

It stores the keyframe in buffer_frame_ if storeKeyFrame(), and processes it with processKeyFrame() if triggerInKeyFrame().

◆ link()

void wolf::ProcessorBase::link ( SensorBasePtr  _sen_ptr)
finalvirtual

Links the processor to a sensor.

◆ localCheck()

CheckLog wolf::ProcessorBase::localCheck ( bool  _verbose,
std::ostream &  _stream,
std::string  _tabs = "" 
) const
virtual

Checks the consistency of this node (not of its children)

◆ permittedKeyFrame()

bool wolf::ProcessorBase::permittedKeyFrame ( ) const
finalprotectedvirtual

Returns whether this processor can create a keyframe: voting is active and the problem permits it.

◆ print()

void wolf::ProcessorBase::print ( int  depth,
bool  factored_by,
bool  metric,
bool  state_blocks,
std::ostream &  stream = std::cout,
std::string  _tabs = "" 
) const

Prints this node and, depending on the depth, its children.

◆ printHeader()

void wolf::ProcessorBase::printHeader ( int  depth,
bool  factored_by,
bool  metric,
bool  state_blocks,
std::ostream &  stream,
std::string  _tabs = "" 
) const
virtual

Prints the information of this node (not of its children)

Reimplemented in wolf::ProcessorMotion, and wolf::ProcessorTracker.

◆ printProfiling()

void wolf::ProcessorBase::printProfiling ( std::ostream &  stream = std::cout) const
virtual

Prints the profiling of the capture and keyframe processing.

Reimplemented in wolf::ProcessorTracker.

◆ processCapture()

virtual void wolf::ProcessorBase::processCapture ( CaptureBasePtr  )
protectedpure virtual

Processes an incoming capture.

Each derived processor should implement this function. It will be called if:

Implemented in wolf::ProcessorPose< DIM >, wolf::ProcessorFixedWingModel, wolf::ProcessorLoopClosure, wolf::ProcessorMotion, and wolf::ProcessorTracker.

◆ processKeyFrame()

virtual void wolf::ProcessorBase::processKeyFrame ( FrameBasePtr  _keyframe_ptr)
protectedpure virtual

Processes an incoming keyframe.

Each derived processor should implement this function. It will be called if:

Implemented in wolf::ProcessorLoopClosure, wolf::ProcessorPose< DIM >, wolf::ProcessorFixedWingModel, wolf::ProcessorMotion, and wolf::ProcessorTracker.

◆ remove()

void wolf::ProcessorBase::remove ( )
virtual

Removes the processor from its sensor (and from the motion providers of the problem)

◆ setApplyLossFunction()

void wolf::ProcessorBase::setApplyLossFunction ( bool  _apply_loss_function)
inline

Sets whether the factors created by the processor apply a loss function.

◆ setDebugVerboseLevel()

void wolf::ProcessorBase::setDebugVerboseLevel ( const std::string &  _debug_verbose_level)
inline

Sets the debug verbosity level: "none", "derived", "base" or "all".

◆ setProblem()

void wolf::ProcessorBase::setProblem ( ProblemPtr  _problem)
overrideprotectedvirtual

Sets the problem, adding the state types to it and, if it is a state provider, the processor as motion provider.

Reimplemented from wolf::NodeBase.

◆ setTimeTolerance()

void wolf::ProcessorBase::setTimeTolerance ( double  _time_tolerance)
inline

Sets the time tolerance to associate time stamps.

◆ setVotingActive()

void wolf::ProcessorBase::setVotingActive ( bool  _voting_active)
inline

Sets whether the processor can vote for keyframes.

◆ startCaptureProfiling()

void wolf::ProcessorBase::startCaptureProfiling ( )
inline

Starts the profiling of a capture processing.

◆ startKFProfiling()

void wolf::ProcessorBase::startKFProfiling ( )
inline

Starts the profiling of a keyframe processing.

◆ stopCaptureProfiling()

void wolf::ProcessorBase::stopCaptureProfiling ( )

Stops the profiling of a capture processing.

◆ stopKFProfiling()

void wolf::ProcessorBase::stopKFProfiling ( )

Stops the profiling of a keyframe processing.

◆ storeCapture()

virtual bool wolf::ProcessorBase::storeCapture ( CaptureBasePtr  )
protectedpure virtual

Returns whether the provided capture should be stored in buffer_capture_.

Implemented in wolf::ProcessorLoopClosure, wolf::ProcessorPose< DIM >, wolf::ProcessorFixedWingModel, wolf::ProcessorMotion, and wolf::ProcessorTracker.

◆ storeKeyFrame()

virtual bool wolf::ProcessorBase::storeKeyFrame ( FrameBasePtr  )
protectedpure virtual

Returns whether the provided keyframe should be stored in buffer_frame_.

Implemented in wolf::ProcessorLoopClosure, wolf::ProcessorPose< DIM >, wolf::ProcessorFixedWingModel, wolf::ProcessorMotion, and wolf::ProcessorTracker.

◆ triggerInCapture()

virtual bool wolf::ProcessorBase::triggerInCapture ( CaptureBasePtr  ) const
protectedpure virtual

Returns whether processCapture() should be called after the provided capture arrived.

Implemented in wolf::ProcessorLoopClosure, wolf::ProcessorPose< DIM >, wolf::ProcessorFixedWingModel, wolf::ProcessorMotion, and wolf::ProcessorTracker.

◆ triggerInKeyFrame()

virtual bool wolf::ProcessorBase::triggerInKeyFrame ( FrameBasePtr  ) const
protectedpure virtual

Returns whether processKeyFrame() should be called after the provided keyframe arrived.

Implemented in wolf::ProcessorLoopClosure, wolf::ProcessorPose< DIM >, wolf::ProcessorFixedWingModel, wolf::ProcessorMotion, and wolf::ProcessorTracker.

◆ voteForKeyFrame()

virtual bool wolf::ProcessorBase::voteForKeyFrame ( ) const
protectedpure virtual

Votes for keyframe generation.

If a KeyFrame criterion is validated, this function returns true, meaning that it wants to create a KeyFrame at the last Capture.

WARNING! This function only votes! It does not create KeyFrames!

Implemented in wolf::ProcessorFixedWingModel, wolf::ProcessorLandmarkExternal, wolf::ProcessorLoopClosure, wolf::ProcessorMotion, wolf::ProcessorOdom2d, wolf::ProcessorOdom3d, wolf::ProcessorPose< DIM >, wolf::ProcessorTracker, wolf::ProcessorTrackerFeature, and wolf::ProcessorTrackerLandmark.

Member Data Documentation

◆ buffer_capture_

BufferCapture wolf::ProcessorBase::buffer_capture_
protected

Buffer of the received captures to be processed.

◆ buffer_frame_

BufferFrame wolf::ProcessorBase::buffer_frame_
protected

Buffer of the received keyframes to be processed.

◆ debug_verbose_level_

std::string wolf::ProcessorBase::debug_verbose_level_
protected

Debug verbosity level: "none", "derived", "base" or "all".

◆ params_

YAML::Node wolf::ProcessorBase::params_
protected

YAML parameters.

◆ processor_id_

unsigned int wolf::ProcessorBase::processor_id_
protected

Processor id, unique among processors.


The documentation for this class was generated from the following files: